// https://leetcode.cn/problems/maximum-product-difference-between-two-pairs/description/
package main

import "sort"

func maxProductDifference(nums []int) int {
    n := len(nums)
	sort.Ints(nums)
	a := nums[n - 1]
	b := nums[n - 2]
	c := nums[0]
	d := nums[1]
	return a * b - c * d
}